package com.google.android.vending.expansion.downloader.impl;

import android.content.Context;
import android.net.Proxy;
import android.os.Build;
import android.os.Build.VERSION;
import android.util.Log;
import com.google.android.vending.expansion.downloader.Helpers;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import java.util.Random;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.methods.HttpGet;

public class DownloadThread
{
  private Context mContext;
  private final DownloadsDB mDB;
  private DownloadInfo mInfo;
  private final DownloadNotification mNotification;
  private DownloaderService mService;
  private String mUserAgent;

  public DownloadThread(DownloadInfo paramDownloadInfo, DownloaderService paramDownloaderService, DownloadNotification paramDownloadNotification)
  {
    this.mContext = paramDownloaderService;
    this.mInfo = paramDownloadInfo;
    this.mService = paramDownloaderService;
    this.mNotification = paramDownloadNotification;
    this.mDB = DownloadsDB.getDB(paramDownloaderService);
    this.mUserAgent = ("APKXDL (Linux; U; Android " + Build.VERSION.RELEASE + ";" + Locale.getDefault().toString() + "; " + Build.DEVICE + "/" + Build.ID + ")" + paramDownloaderService.getPackageName());
  }

  private void addRequestHeaders(InnerState paramInnerState, HttpGet paramHttpGet)
  {
    if (paramInnerState.mContinuingDownload)
    {
      if (paramInnerState.mHeaderETag != null)
        paramHttpGet.addHeader("If-Match", paramInnerState.mHeaderETag);
      paramHttpGet.addHeader("Range", "bytes=" + paramInnerState.mBytesSoFar + "-");
    }
  }

  private boolean cannotResume(InnerState paramInnerState)
  {
    return (paramInnerState.mBytesSoFar > 0) && (paramInnerState.mHeaderETag == null);
  }

  private void checkConnectivity(State paramState)
    throws DownloadThread.StopRequest
  {
    switch (this.mService.getNetworkAvailabilityState(this.mDB))
    {
    case 1:
    case 4:
    default:
      return;
    case 2:
      throw new StopRequest(195, "waiting for network to return");
    case 6:
      throw new StopRequest(196, "waiting for wifi or for download over cellular to be authorized");
    case 5:
      throw new StopRequest(195, "roaming is not allowed");
    case 3:
    }
    throw new StopRequest(197, "waiting for wifi");
  }

  private void checkPausedOrCanceled(State paramState)
    throws DownloadThread.StopRequest
  {
    if (this.mService.getControl() == 1);
    switch (this.mService.getStatus())
    {
    default:
      return;
    case 193:
    }
    throw new StopRequest(this.mService.getStatus(), "download paused");
  }

  private void cleanupDestination(State paramState, int paramInt)
  {
    closeDestination(paramState);
    if ((paramState.mFilename != null) && (DownloaderService.isStatusError(paramInt)))
    {
      new File(paramState.mFilename).delete();
      paramState.mFilename = null;
    }
  }

  private void closeDestination(State paramState)
  {
    try
    {
      if (paramState.mStream != null)
      {
        paramState.mStream.close();
        paramState.mStream = null;
      }
      return;
    }
    catch (IOException localIOException)
    {
    }
  }

  private void executeDownload(State paramState, AndroidHttpClient paramAndroidHttpClient, HttpGet paramHttpGet)
    throws DownloadThread.StopRequest, DownloadThread.RetryDownload
  {
    InnerState localInnerState = new InnerState(null);
    byte[] arrayOfByte = new byte[4096];
    checkPausedOrCanceled(paramState);
    setupDestinationFile(paramState, localInnerState);
    addRequestHeaders(localInnerState, paramHttpGet);
    checkConnectivity(paramState);
    this.mNotification.onDownloadStateChanged(3);
    HttpResponse localHttpResponse = sendRequest(paramState, paramAndroidHttpClient, paramHttpGet);
    handleExceptionalStatus(paramState, localInnerState, localHttpResponse);
    processResponseHeaders(paramState, localInnerState, localHttpResponse);
    InputStream localInputStream = openResponseEntity(paramState, localHttpResponse);
    this.mNotification.onDownloadStateChanged(4);
    transferData(paramState, localInnerState, arrayOfByte, localInputStream);
  }

  private void finalizeDestinationFile(State paramState)
    throws DownloadThread.StopRequest
  {
    syncDestination(paramState);
    String str1 = paramState.mFilename;
    String str2 = Helpers.generateSaveFileName(this.mService, this.mInfo.mFileName);
    if (!paramState.mFilename.equals(str2))
    {
      File localFile1 = new File(str1);
      File localFile2 = new File(str2);
      if ((this.mInfo.mTotalBytes != -1L) && (this.mInfo.mCurrentBytes == this.mInfo.mTotalBytes))
      {
        if (!localFile1.renameTo(localFile2))
          throw new StopRequest(492, "unable to finalize destination file");
      }
      else
        throw new StopRequest(487, "file delivered with incorrect size. probably due to network not browser configured");
    }
  }

  private int getFinalStatusForHttpError(State paramState)
  {
    if (this.mService.getNetworkAvailabilityState(this.mDB) != 1)
      return 195;
    if (this.mInfo.mNumFailed < 5)
    {
      paramState.mCountRetry = true;
      return 194;
    }
    Log.w("LVLDL", "reached max retries for " + this.mInfo.mNumFailed);
    return 495;
  }

  private void handleEndOfStream(State paramState, InnerState paramInnerState)
    throws DownloadThread.StopRequest
  {
    this.mInfo.mCurrentBytes = paramInnerState.mBytesSoFar;
    this.mDB.updateDownload(this.mInfo);
    int i;
    if ((paramInnerState.mHeaderContentLength != null) && (paramInnerState.mBytesSoFar != Integer.parseInt(paramInnerState.mHeaderContentLength)))
      i = 1;
    while (i != 0)
      if (cannotResume(paramInnerState))
      {
        throw new StopRequest(489, "mismatched content length");
        i = 0;
      }
      else
      {
        throw new StopRequest(getFinalStatusForHttpError(paramState), "closed socket before end of file");
      }
  }

  private void handleExceptionalStatus(State paramState, InnerState paramInnerState, HttpResponse paramHttpResponse)
    throws DownloadThread.StopRequest, DownloadThread.RetryDownload
  {
    int i = paramHttpResponse.getStatusLine().getStatusCode();
    if ((i == 503) && (this.mInfo.mNumFailed < 5))
      handleServiceUnavailable(paramState, paramHttpResponse);
    if ((i == 301) || (i == 302) || (i == 303) || (i == 307))
      handleRedirect(paramState, paramHttpResponse, i);
    if (paramInnerState.mContinuingDownload);
    for (int j = 206; i != j; j = 200)
    {
      handleOtherStatus(paramState, paramInnerState, i);
      return;
    }
    paramState.mRedirectCount = 0;
  }

  private void handleOtherStatus(State paramState, InnerState paramInnerState, int paramInt)
    throws DownloadThread.StopRequest
  {
    int i;
    if (DownloaderService.isStatusError(paramInt))
      i = paramInt;
    while (true)
    {
      throw new StopRequest(i, "http error " + paramInt);
      if ((paramInt >= 300) && (paramInt < 400))
        i = 493;
      else if ((paramInnerState.mContinuingDownload) && (paramInt == 200))
        i = 489;
      else
        i = 494;
    }
  }

  private void handleRedirect(State paramState, HttpResponse paramHttpResponse, int paramInt)
    throws DownloadThread.StopRequest, DownloadThread.RetryDownload
  {
    if (paramState.mRedirectCount >= 5)
      throw new StopRequest(497, "too many redirects");
    Header localHeader = paramHttpResponse.getFirstHeader("Location");
    if (localHeader == null)
      return;
    try
    {
      String str = new URI(this.mInfo.mUri).resolve(new URI(localHeader.getValue())).toString();
      paramState.mRedirectCount = (1 + paramState.mRedirectCount);
      paramState.mRequestUri = str;
      if ((paramInt == 301) || (paramInt == 303))
        paramState.mNewUri = str;
      throw new RetryDownload(null);
    }
    catch (URISyntaxException localURISyntaxException)
    {
    }
    throw new StopRequest(495, "Couldn't resolve redirect URI");
  }

  private void handleServiceUnavailable(State paramState, HttpResponse paramHttpResponse)
    throws DownloadThread.StopRequest
  {
    paramState.mCountRetry = true;
    Header localHeader = paramHttpResponse.getFirstHeader("Retry-After");
    if (localHeader != null);
    try
    {
      paramState.mRetryAfter = Integer.parseInt(localHeader.getValue());
      if (paramState.mRetryAfter < 0)
      {
        paramState.mRetryAfter = 0;
        label44: throw new StopRequest(194, "got 503 Service Unavailable, will retry later");
      }
      if (paramState.mRetryAfter < 30)
        paramState.mRetryAfter = 30;
      while (true)
      {
        paramState.mRetryAfter += Helpers.sRandom.nextInt(31);
        paramState.mRetryAfter = (1000 * paramState.mRetryAfter);
        break;
        if (paramState.mRetryAfter > 86400)
          paramState.mRetryAfter = 86400;
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      break label44;
    }
  }

  private static final boolean isLocalHost(String paramString)
  {
    if (paramString == null);
    while (true)
    {
      return false;
      try
      {
        String str = URI.create(paramString).getHost();
        if (str != null)
          if ((!str.equalsIgnoreCase("localhost")) && (!str.equals("127.0.0.1")))
          {
            boolean bool = str.equals("[::1]");
            if (!bool);
          }
          else
          {
            return true;
          }
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
      }
    }
    return false;
  }

  private void logNetworkState()
  {
    StringBuilder localStringBuilder = new StringBuilder().append("Net ");
    if (this.mService.getNetworkAvailabilityState(this.mDB) == 1);
    for (String str = "Up"; ; str = "Down")
    {
      Log.i("LVLDL", str);
      return;
    }
  }

  private void notifyDownloadCompleted(int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, boolean paramBoolean2, String paramString)
  {
    updateDownloadDatabase(paramInt1, paramBoolean1, paramInt2, paramInt3, paramBoolean2, paramString);
    if (DownloaderService.isStatusCompleted(paramInt1));
  }

  private InputStream openResponseEntity(State paramState, HttpResponse paramHttpResponse)
    throws DownloadThread.StopRequest
  {
    try
    {
      InputStream localInputStream = paramHttpResponse.getEntity().getContent();
      return localInputStream;
    }
    catch (IOException localIOException)
    {
      logNetworkState();
      throw new StopRequest(getFinalStatusForHttpError(paramState), "while getting entity: " + localIOException.toString(), localIOException);
    }
  }

  // ERROR //
  private void processResponseHeaders(State paramState, InnerState paramInnerState, HttpResponse paramHttpResponse)
    throws DownloadThread.StopRequest
  {
    // Byte code:
    //   0: aload_2
    //   1: getfield 93	com/google/android/vending/expansion/downloader/impl/DownloadThread$InnerState:mContinuingDownload	Z
    //   4: ifeq +4 -> 8
    //   7: return
    //   8: aload_0
    //   9: aload_1
    //   10: aload_2
    //   11: aload_3
    //   12: invokespecial 452	com/google/android/vending/expansion/downloader/impl/DownloadThread:readResponseHeaders	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V
    //   15: aload_1
    //   16: aload_0
    //   17: getfield 27	com/google/android/vending/expansion/downloader/impl/DownloadThread:mService	Lcom/google/android/vending/expansion/downloader/impl/DownloaderService;
    //   20: aload_0
    //   21: getfield 25	com/google/android/vending/expansion/downloader/impl/DownloadThread:mInfo	Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;
    //   24: getfield 233	com/google/android/vending/expansion/downloader/impl/DownloadInfo:mFileName	Ljava/lang/String;
    //   27: aload_0
    //   28: getfield 25	com/google/android/vending/expansion/downloader/impl/DownloadThread:mInfo	Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;
    //   31: getfield 249	com/google/android/vending/expansion/downloader/impl/DownloadInfo:mTotalBytes	J
    //   34: invokevirtual 456	com/google/android/vending/expansion/downloader/impl/DownloaderService:generateSaveFile	(Ljava/lang/String;J)Ljava/lang/String;
    //   37: putfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   40: aload_1
    //   41: new 179	java/io/FileOutputStream
    //   44: dup
    //   45: aload_1
    //   46: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   49: invokespecial 457	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   52: putfield 177	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mStream	Ljava/io/FileOutputStream;
    //   55: aload_0
    //   56: aload_1
    //   57: aload_2
    //   58: invokespecial 460	com/google/android/vending/expansion/downloader/impl/DownloadThread:updateDatabaseFromHeaders	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$InnerState;)V
    //   61: aload_0
    //   62: aload_1
    //   63: invokespecial 199	com/google/android/vending/expansion/downloader/impl/DownloadThread:checkConnectivity	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;)V
    //   66: return
    //   67: astore 4
    //   69: new 123	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   72: dup
    //   73: aload_0
    //   74: aload 4
    //   76: getfield 463	com/google/android/vending/expansion/downloader/impl/DownloaderService$GenerateSaveFileError:mStatus	I
    //   79: aload 4
    //   81: getfield 466	com/google/android/vending/expansion/downloader/impl/DownloaderService$GenerateSaveFileError:mMessage	Ljava/lang/String;
    //   84: invokespecial 132	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest:<init>	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread;ILjava/lang/String;)V
    //   87: athrow
    //   88: astore 5
    //   90: new 164	java/io/File
    //   93: dup
    //   94: aload_0
    //   95: getfield 27	com/google/android/vending/expansion/downloader/impl/DownloadThread:mService	Lcom/google/android/vending/expansion/downloader/impl/DownloaderService;
    //   98: invokestatic 470	com/google/android/vending/expansion/downloader/Helpers:getSaveFilePath	(Landroid/content/Context;)Ljava/lang/String;
    //   101: invokespecial 167	java/io/File:<init>	(Ljava/lang/String;)V
    //   104: astore 6
    //   106: aload 6
    //   108: invokevirtual 473	java/io/File:mkdirs	()Z
    //   111: ifeq -56 -> 55
    //   114: aload_1
    //   115: new 179	java/io/FileOutputStream
    //   118: dup
    //   119: aload_1
    //   120: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   123: invokespecial 457	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   126: putfield 177	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mStream	Ljava/io/FileOutputStream;
    //   129: goto -74 -> 55
    //   132: astore 7
    //   134: new 123	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   137: dup
    //   138: aload_0
    //   139: sipush 492
    //   142: new 39	java/lang/StringBuilder
    //   145: dup
    //   146: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   149: ldc_w 475
    //   152: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   155: aload 5
    //   157: invokevirtual 476	java/io/FileNotFoundException:toString	()Ljava/lang/String;
    //   160: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   163: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   166: aload 5
    //   168: invokespecial 443	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest:<init>	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   171: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   15	40	67	com/google/android/vending/expansion/downloader/impl/DownloaderService$GenerateSaveFileError
    //   40	55	88	java/io/FileNotFoundException
    //   106	129	132	java/lang/Exception
  }

  private int readFromResponse(State paramState, InnerState paramInnerState, byte[] paramArrayOfByte, InputStream paramInputStream)
    throws DownloadThread.StopRequest
  {
    try
    {
      int i = paramInputStream.read(paramArrayOfByte);
      return i;
    }
    catch (IOException localIOException)
    {
      logNetworkState();
      this.mInfo.mCurrentBytes = paramInnerState.mBytesSoFar;
      this.mDB.updateDownload(this.mInfo);
      if (cannotResume(paramInnerState))
        throw new StopRequest(489, "while reading response: " + localIOException.toString() + ", can't resume interrupted download with no ETag", localIOException);
      throw new StopRequest(getFinalStatusForHttpError(paramState), "while reading response: " + localIOException.toString(), localIOException);
    }
  }

  private void readResponseHeaders(State paramState, InnerState paramInnerState, HttpResponse paramHttpResponse)
    throws DownloadThread.StopRequest
  {
    Header localHeader1 = paramHttpResponse.getFirstHeader("Content-Disposition");
    if (localHeader1 != null)
      paramInnerState.mHeaderContentDisposition = localHeader1.getValue();
    Header localHeader2 = paramHttpResponse.getFirstHeader("Content-Location");
    if (localHeader2 != null)
      paramInnerState.mHeaderContentLocation = localHeader2.getValue();
    Header localHeader3 = paramHttpResponse.getFirstHeader("ETag");
    if (localHeader3 != null)
      paramInnerState.mHeaderETag = localHeader3.getValue();
    Header localHeader4 = paramHttpResponse.getFirstHeader("Transfer-Encoding");
    String str = null;
    if (localHeader4 != null)
      str = localHeader4.getValue();
    Header localHeader5 = paramHttpResponse.getFirstHeader("Content-Type");
    if ((localHeader5 != null) && (!localHeader5.getValue().equals("application/vnd.android.obb")))
      throw new StopRequest(487, "file delivered with incorrect Mime type");
    if (str == null)
    {
      Header localHeader6 = paramHttpResponse.getFirstHeader("Content-Length");
      if (localHeader6 != null)
      {
        paramInnerState.mHeaderContentLength = localHeader6.getValue();
        long l = Long.parseLong(paramInnerState.mHeaderContentLength);
        if ((l != -1L) && (l != this.mInfo.mTotalBytes))
          Log.e("LVLDL", "Incorrect file size delivered.");
      }
    }
    if ((paramInnerState.mHeaderContentLength == null) && ((str == null) || (!str.equalsIgnoreCase("chunked"))));
    for (int i = 1; i != 0; i = 0)
      throw new StopRequest(495, "can't know size of download, giving up");
  }

  private void reportProgress(State paramState, InnerState paramInnerState)
  {
    long l1 = System.currentTimeMillis();
    if ((paramInnerState.mBytesSoFar - paramInnerState.mBytesNotified > 4096) && (l1 - paramInnerState.mTimeLastNotification > 1000L))
    {
      this.mInfo.mCurrentBytes = paramInnerState.mBytesSoFar;
      this.mDB.updateDownloadCurrentBytes(this.mInfo);
      paramInnerState.mBytesNotified = paramInnerState.mBytesSoFar;
      paramInnerState.mTimeLastNotification = l1;
      long l2 = paramInnerState.mBytesThisSession + this.mService.mBytesSoFar;
      this.mService.notifyUpdateBytes(l2);
    }
  }

  private HttpResponse sendRequest(State paramState, AndroidHttpClient paramAndroidHttpClient, HttpGet paramHttpGet)
    throws DownloadThread.StopRequest
  {
    try
    {
      HttpResponse localHttpResponse = paramAndroidHttpClient.execute(paramHttpGet);
      return localHttpResponse;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new StopRequest(495, "while trying to execute request: " + localIllegalArgumentException.toString(), localIllegalArgumentException);
    }
    catch (IOException localIOException)
    {
      logNetworkState();
      throw new StopRequest(getFinalStatusForHttpError(paramState), "while trying to execute request: " + localIOException.toString(), localIOException);
    }
  }

  private void setupDestinationFile(State paramState, InnerState paramInnerState)
    throws DownloadThread.StopRequest
  {
    File localFile;
    long l;
    if (paramState.mFilename != null)
    {
      if (!Helpers.isFilenameValid(paramState.mFilename))
        throw new StopRequest(492, "found invalid internal destination filename");
      localFile = new File(paramState.mFilename);
      if (localFile.exists())
      {
        l = localFile.length();
        if (l != 0L)
          break label87;
        localFile.delete();
        paramState.mFilename = null;
      }
    }
    while (true)
    {
      if (paramState.mStream != null)
        closeDestination(paramState);
      return;
      label87: if (this.mInfo.mETag == null)
      {
        localFile.delete();
        throw new StopRequest(489, "Trying to resume a download that can't be resumed");
      }
      try
      {
        paramState.mStream = new FileOutputStream(paramState.mFilename, true);
        paramInnerState.mBytesSoFar = ((int)l);
        if (this.mInfo.mTotalBytes != -1L)
          paramInnerState.mHeaderContentLength = Long.toString(this.mInfo.mTotalBytes);
        paramInnerState.mHeaderETag = this.mInfo.mETag;
        paramInnerState.mContinuingDownload = true;
      }
      catch (FileNotFoundException localFileNotFoundException)
      {
        throw new StopRequest(492, "while opening destination for resuming: " + localFileNotFoundException.toString(), localFileNotFoundException);
      }
    }
  }

  // ERROR //
  private void syncDestination(State paramState)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: new 179	java/io/FileOutputStream
    //   5: dup
    //   6: aload_1
    //   7: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   10: iconst_1
    //   11: invokespecial 581	java/io/FileOutputStream:<init>	(Ljava/lang/String;Z)V
    //   14: astore_3
    //   15: aload_3
    //   16: invokevirtual 594	java/io/FileOutputStream:getFD	()Ljava/io/FileDescriptor;
    //   19: invokevirtual 599	java/io/FileDescriptor:sync	()V
    //   22: aload_3
    //   23: ifnull +419 -> 442
    //   26: aload_3
    //   27: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   30: return
    //   31: astore 35
    //   33: ldc_w 272
    //   36: ldc_w 601
    //   39: aload 35
    //   41: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   44: pop
    //   45: return
    //   46: astore 33
    //   48: ldc_w 272
    //   51: ldc_w 606
    //   54: aload 33
    //   56: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   59: pop
    //   60: return
    //   61: astore 4
    //   63: ldc_w 272
    //   66: new 39	java/lang/StringBuilder
    //   69: dup
    //   70: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   73: ldc_w 608
    //   76: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   79: aload_1
    //   80: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   83: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   86: ldc_w 610
    //   89: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   92: aload 4
    //   94: invokevirtual 613	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   97: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   100: invokestatic 280	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   103: pop
    //   104: aload_2
    //   105: ifnull -75 -> 30
    //   108: aload_2
    //   109: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   112: return
    //   113: astore 13
    //   115: ldc_w 272
    //   118: ldc_w 601
    //   121: aload 13
    //   123: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   126: pop
    //   127: return
    //   128: astore 11
    //   130: ldc_w 272
    //   133: ldc_w 606
    //   136: aload 11
    //   138: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   141: pop
    //   142: return
    //   143: astore 15
    //   145: ldc_w 272
    //   148: new 39	java/lang/StringBuilder
    //   151: dup
    //   152: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   155: ldc_w 608
    //   158: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   161: aload_1
    //   162: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   165: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   168: ldc_w 615
    //   171: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   174: aload 15
    //   176: invokevirtual 613	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   179: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   182: invokestatic 280	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   185: pop
    //   186: aload_2
    //   187: ifnull -157 -> 30
    //   190: aload_2
    //   191: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   194: return
    //   195: astore 19
    //   197: ldc_w 272
    //   200: ldc_w 601
    //   203: aload 19
    //   205: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   208: pop
    //   209: return
    //   210: astore 17
    //   212: ldc_w 272
    //   215: ldc_w 606
    //   218: aload 17
    //   220: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   223: pop
    //   224: return
    //   225: astore 21
    //   227: ldc_w 272
    //   230: new 39	java/lang/StringBuilder
    //   233: dup
    //   234: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   237: ldc_w 617
    //   240: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   243: aload_1
    //   244: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   247: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   250: ldc_w 619
    //   253: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   256: aload 21
    //   258: invokevirtual 613	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   261: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   264: invokestatic 280	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   267: pop
    //   268: aload_2
    //   269: ifnull -239 -> 30
    //   272: aload_2
    //   273: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   276: return
    //   277: astore 25
    //   279: ldc_w 272
    //   282: ldc_w 601
    //   285: aload 25
    //   287: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   290: pop
    //   291: return
    //   292: astore 23
    //   294: ldc_w 272
    //   297: ldc_w 606
    //   300: aload 23
    //   302: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   305: pop
    //   306: return
    //   307: astore 27
    //   309: ldc_w 272
    //   312: ldc_w 621
    //   315: aload 27
    //   317: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   320: pop
    //   321: aload_2
    //   322: ifnull -292 -> 30
    //   325: aload_2
    //   326: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   329: return
    //   330: astore 31
    //   332: ldc_w 272
    //   335: ldc_w 601
    //   338: aload 31
    //   340: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   343: pop
    //   344: return
    //   345: astore 29
    //   347: ldc_w 272
    //   350: ldc_w 606
    //   353: aload 29
    //   355: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   358: pop
    //   359: return
    //   360: astore 5
    //   362: aload_2
    //   363: ifnull +7 -> 370
    //   366: aload_2
    //   367: invokevirtual 182	java/io/FileOutputStream:close	()V
    //   370: aload 5
    //   372: athrow
    //   373: astore 8
    //   375: ldc_w 272
    //   378: ldc_w 601
    //   381: aload 8
    //   383: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   386: pop
    //   387: goto -17 -> 370
    //   390: astore 6
    //   392: ldc_w 272
    //   395: ldc_w 606
    //   398: aload 6
    //   400: invokestatic 604	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   403: pop
    //   404: goto -34 -> 370
    //   407: astore 5
    //   409: aload_3
    //   410: astore_2
    //   411: goto -49 -> 362
    //   414: astore 27
    //   416: aload_3
    //   417: astore_2
    //   418: goto -109 -> 309
    //   421: astore 21
    //   423: aload_3
    //   424: astore_2
    //   425: goto -198 -> 227
    //   428: astore 15
    //   430: aload_3
    //   431: astore_2
    //   432: goto -287 -> 145
    //   435: astore 4
    //   437: aload_3
    //   438: astore_2
    //   439: goto -376 -> 63
    //   442: return
    //
    // Exception table:
    //   from	to	target	type
    //   26	30	31	java/io/IOException
    //   26	30	46	java/lang/RuntimeException
    //   2	15	61	java/io/FileNotFoundException
    //   108	112	113	java/io/IOException
    //   108	112	128	java/lang/RuntimeException
    //   2	15	143	java/io/SyncFailedException
    //   190	194	195	java/io/IOException
    //   190	194	210	java/lang/RuntimeException
    //   2	15	225	java/io/IOException
    //   272	276	277	java/io/IOException
    //   272	276	292	java/lang/RuntimeException
    //   2	15	307	java/lang/RuntimeException
    //   325	329	330	java/io/IOException
    //   325	329	345	java/lang/RuntimeException
    //   2	15	360	finally
    //   63	104	360	finally
    //   145	186	360	finally
    //   227	268	360	finally
    //   309	321	360	finally
    //   366	370	373	java/io/IOException
    //   366	370	390	java/lang/RuntimeException
    //   15	22	407	finally
    //   15	22	414	java/lang/RuntimeException
    //   15	22	421	java/io/IOException
    //   15	22	428	java/io/SyncFailedException
    //   15	22	435	java/io/FileNotFoundException
  }

  private void transferData(State paramState, InnerState paramInnerState, byte[] paramArrayOfByte, InputStream paramInputStream)
    throws DownloadThread.StopRequest
  {
    while (true)
    {
      int i = readFromResponse(paramState, paramInnerState, paramArrayOfByte, paramInputStream);
      if (i == -1)
      {
        handleEndOfStream(paramState, paramInnerState);
        return;
      }
      paramState.mGotData = true;
      writeDataToDestination(paramState, paramArrayOfByte, i);
      paramInnerState.mBytesSoFar = (i + paramInnerState.mBytesSoFar);
      paramInnerState.mBytesThisSession = (i + paramInnerState.mBytesThisSession);
      reportProgress(paramState, paramInnerState);
      checkPausedOrCanceled(paramState);
    }
  }

  private void updateDatabaseFromHeaders(State paramState, InnerState paramInnerState)
  {
    this.mInfo.mETag = paramInnerState.mHeaderETag;
    this.mDB.updateDownload(this.mInfo);
  }

  private void updateDownloadDatabase(int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, boolean paramBoolean2, String paramString)
  {
    this.mInfo.mStatus = paramInt1;
    this.mInfo.mRetryAfter = paramInt2;
    this.mInfo.mRedirectCount = paramInt3;
    this.mInfo.mLastMod = System.currentTimeMillis();
    if (!paramBoolean1)
      this.mInfo.mNumFailed = 0;
    while (true)
    {
      this.mDB.updateDownload(this.mInfo);
      return;
      if (paramBoolean2)
      {
        this.mInfo.mNumFailed = 1;
      }
      else
      {
        DownloadInfo localDownloadInfo = this.mInfo;
        localDownloadInfo.mNumFailed = (1 + localDownloadInfo.mNumFailed);
      }
    }
  }

  private String userAgent()
  {
    return this.mUserAgent;
  }

  private void writeDataToDestination(State paramState, byte[] paramArrayOfByte, int paramInt)
    throws DownloadThread.StopRequest
  {
    try
    {
      if (paramState.mStream == null)
        paramState.mStream = new FileOutputStream(paramState.mFilename, true);
      paramState.mStream.write(paramArrayOfByte, 0, paramInt);
      closeDestination(paramState);
      return;
    }
    catch (IOException localIOException)
    {
      if (!Helpers.isExternalMediaMounted())
        throw new StopRequest(499, "external media not mounted while writing destination file");
      if (Helpers.getAvailableBytes(Helpers.getFilesystemRoot(paramState.mFilename)) < paramInt)
        throw new StopRequest(498, "insufficient space while writing destination file", localIOException);
      throw new StopRequest(492, "while writing destination file: " + localIOException.toString(), localIOException);
    }
  }

  public HttpHost getPreferredHttpHost(Context paramContext, String paramString)
  {
    if ((!isLocalHost(paramString)) && (!this.mService.isWiFi()))
    {
      String str = Proxy.getHost(paramContext);
      if (str != null)
        return new HttpHost(str, Proxy.getPort(paramContext), "http");
    }
    return null;
  }

  // ERROR //
  public void run()
  {
    // Byte code:
    //   0: bipush 10
    //   2: invokestatic 692	android/os/Process:setThreadPriority	(I)V
    //   5: new 155	com/google/android/vending/expansion/downloader/impl/DownloadThread$State
    //   8: dup
    //   9: aload_0
    //   10: getfield 25	com/google/android/vending/expansion/downloader/impl/DownloadThread:mInfo	Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;
    //   13: aload_0
    //   14: getfield 27	com/google/android/vending/expansion/downloader/impl/DownloadThread:mService	Lcom/google/android/vending/expansion/downloader/impl/DownloaderService;
    //   17: invokespecial 695	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:<init>	(Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;Lcom/google/android/vending/expansion/downloader/impl/DownloaderService;)V
    //   20: astore_1
    //   21: aconst_null
    //   22: astore_2
    //   23: aconst_null
    //   24: astore_3
    //   25: aload_0
    //   26: getfield 23	com/google/android/vending/expansion/downloader/impl/DownloadThread:mContext	Landroid/content/Context;
    //   29: ldc_w 697
    //   32: invokevirtual 703	android/content/Context:getSystemService	(Ljava/lang/String;)Ljava/lang/Object;
    //   35: checkcast 705	android/os/PowerManager
    //   38: iconst_1
    //   39: ldc_w 272
    //   42: invokevirtual 709	android/os/PowerManager:newWakeLock	(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
    //   45: astore_3
    //   46: aload_3
    //   47: invokevirtual 714	android/os/PowerManager$WakeLock:acquire	()V
    //   50: aload_0
    //   51: invokespecial 716	com/google/android/vending/expansion/downloader/impl/DownloadThread:userAgent	()Ljava/lang/String;
    //   54: aload_0
    //   55: getfield 23	com/google/android/vending/expansion/downloader/impl/DownloadThread:mContext	Landroid/content/Context;
    //   58: invokestatic 720	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:newInstance	(Ljava/lang/String;Landroid/content/Context;)Lcom/google/android/vending/expansion/downloader/impl/AndroidHttpClient;
    //   61: astore_2
    //   62: iconst_0
    //   63: istore 10
    //   65: iload 10
    //   67: ifne +185 -> 252
    //   70: aload_2
    //   71: invokevirtual 724	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:getParams	()Lorg/apache/http/params/HttpParams;
    //   74: aload_0
    //   75: aload_0
    //   76: getfield 23	com/google/android/vending/expansion/downloader/impl/DownloadThread:mContext	Landroid/content/Context;
    //   79: aload_1
    //   80: getfield 359	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRequestUri	Ljava/lang/String;
    //   83: invokevirtual 726	com/google/android/vending/expansion/downloader/impl/DownloadThread:getPreferredHttpHost	(Landroid/content/Context;Ljava/lang/String;)Lorg/apache/http/HttpHost;
    //   86: invokestatic 732	org/apache/http/conn/params/ConnRouteParams:setDefaultProxy	(Lorg/apache/http/params/HttpParams;Lorg/apache/http/HttpHost;)V
    //   89: new 100	org/apache/http/client/methods/HttpGet
    //   92: dup
    //   93: aload_1
    //   94: getfield 359	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRequestUri	Ljava/lang/String;
    //   97: invokespecial 733	org/apache/http/client/methods/HttpGet:<init>	(Ljava/lang/String;)V
    //   100: astore 11
    //   102: aload_0
    //   103: aload_1
    //   104: aload_2
    //   105: aload 11
    //   107: invokespecial 735	com/google/android/vending/expansion/downloader/impl/DownloadThread:executeDownload	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;Lcom/google/android/vending/expansion/downloader/impl/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)V
    //   110: iconst_1
    //   111: istore 10
    //   113: aload 11
    //   115: invokevirtual 738	org/apache/http/client/methods/HttpGet:abort	()V
    //   118: goto -53 -> 65
    //   121: astore 13
    //   123: aload 11
    //   125: invokevirtual 738	org/apache/http/client/methods/HttpGet:abort	()V
    //   128: goto -63 -> 65
    //   131: astore 12
    //   133: aload 11
    //   135: invokevirtual 738	org/apache/http/client/methods/HttpGet:abort	()V
    //   138: aload 12
    //   140: athrow
    //   141: astore 7
    //   143: ldc_w 272
    //   146: new 39	java/lang/StringBuilder
    //   149: dup
    //   150: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   153: ldc_w 740
    //   156: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   159: aload_0
    //   160: getfield 25	com/google/android/vending/expansion/downloader/impl/DownloadThread:mInfo	Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;
    //   163: getfield 233	com/google/android/vending/expansion/downloader/impl/DownloadInfo:mFileName	Ljava/lang/String;
    //   166: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   169: ldc_w 619
    //   172: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   175: aload 7
    //   177: invokevirtual 743	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest:getMessage	()Ljava/lang/String;
    //   180: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   183: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   186: invokestatic 280	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   189: pop
    //   190: aload 7
    //   192: invokevirtual 746	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest:printStackTrace	()V
    //   195: aload 7
    //   197: getfield 749	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest:mFinalStatus	I
    //   200: istore 9
    //   202: aload_3
    //   203: ifnull +7 -> 210
    //   206: aload_3
    //   207: invokevirtual 752	android/os/PowerManager$WakeLock:release	()V
    //   210: aload_2
    //   211: ifnull +7 -> 218
    //   214: aload_2
    //   215: invokevirtual 753	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:close	()V
    //   218: aload_0
    //   219: aload_1
    //   220: iload 9
    //   222: invokespecial 755	com/google/android/vending/expansion/downloader/impl/DownloadThread:cleanupDestination	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;I)V
    //   225: aload_0
    //   226: iload 9
    //   228: aload_1
    //   229: getfield 270	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mCountRetry	Z
    //   232: aload_1
    //   233: getfield 374	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRetryAfter	I
    //   236: aload_1
    //   237: getfield 328	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRedirectCount	I
    //   240: aload_1
    //   241: getfield 628	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mGotData	Z
    //   244: aload_1
    //   245: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   248: invokespecial 757	com/google/android/vending/expansion/downloader/impl/DownloadThread:notifyDownloadCompleted	(IZIIZLjava/lang/String;)V
    //   251: return
    //   252: aload_0
    //   253: aload_1
    //   254: invokespecial 759	com/google/android/vending/expansion/downloader/impl/DownloadThread:finalizeDestinationFile	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;)V
    //   257: aload_3
    //   258: ifnull +7 -> 265
    //   261: aload_3
    //   262: invokevirtual 752	android/os/PowerManager$WakeLock:release	()V
    //   265: aload_2
    //   266: ifnull +7 -> 273
    //   269: aload_2
    //   270: invokevirtual 753	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:close	()V
    //   273: aload_0
    //   274: aload_1
    //   275: sipush 200
    //   278: invokespecial 755	com/google/android/vending/expansion/downloader/impl/DownloadThread:cleanupDestination	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;I)V
    //   281: aload_0
    //   282: sipush 200
    //   285: aload_1
    //   286: getfield 270	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mCountRetry	Z
    //   289: aload_1
    //   290: getfield 374	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRetryAfter	I
    //   293: aload_1
    //   294: getfield 328	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRedirectCount	I
    //   297: aload_1
    //   298: getfield 628	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mGotData	Z
    //   301: aload_1
    //   302: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   305: invokespecial 757	com/google/android/vending/expansion/downloader/impl/DownloadThread:notifyDownloadCompleted	(IZIIZLjava/lang/String;)V
    //   308: return
    //   309: astore 5
    //   311: ldc_w 272
    //   314: new 39	java/lang/StringBuilder
    //   317: dup
    //   318: invokespecial 40	java/lang/StringBuilder:<init>	()V
    //   321: ldc_w 761
    //   324: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   327: aload_0
    //   328: getfield 25	com/google/android/vending/expansion/downloader/impl/DownloadThread:mInfo	Lcom/google/android/vending/expansion/downloader/impl/DownloadInfo;
    //   331: getfield 233	com/google/android/vending/expansion/downloader/impl/DownloadInfo:mFileName	Ljava/lang/String;
    //   334: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   337: ldc_w 619
    //   340: invokevirtual 46	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   343: aload 5
    //   345: invokevirtual 613	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   348: invokevirtual 83	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   351: invokestatic 280	android/util/Log:w	(Ljava/lang/String;Ljava/lang/String;)I
    //   354: pop
    //   355: aload_3
    //   356: ifnull +7 -> 363
    //   359: aload_3
    //   360: invokevirtual 752	android/os/PowerManager$WakeLock:release	()V
    //   363: aload_2
    //   364: ifnull +7 -> 371
    //   367: aload_2
    //   368: invokevirtual 753	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:close	()V
    //   371: aload_0
    //   372: aload_1
    //   373: sipush 491
    //   376: invokespecial 755	com/google/android/vending/expansion/downloader/impl/DownloadThread:cleanupDestination	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;I)V
    //   379: aload_0
    //   380: sipush 491
    //   383: aload_1
    //   384: getfield 270	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mCountRetry	Z
    //   387: aload_1
    //   388: getfield 374	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRetryAfter	I
    //   391: aload_1
    //   392: getfield 328	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRedirectCount	I
    //   395: aload_1
    //   396: getfield 628	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mGotData	Z
    //   399: aload_1
    //   400: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   403: invokespecial 757	com/google/android/vending/expansion/downloader/impl/DownloadThread:notifyDownloadCompleted	(IZIIZLjava/lang/String;)V
    //   406: return
    //   407: astore 4
    //   409: aload_3
    //   410: ifnull +7 -> 417
    //   413: aload_3
    //   414: invokevirtual 752	android/os/PowerManager$WakeLock:release	()V
    //   417: aload_2
    //   418: ifnull +7 -> 425
    //   421: aload_2
    //   422: invokevirtual 753	com/google/android/vending/expansion/downloader/impl/AndroidHttpClient:close	()V
    //   425: aload_0
    //   426: aload_1
    //   427: sipush 491
    //   430: invokespecial 755	com/google/android/vending/expansion/downloader/impl/DownloadThread:cleanupDestination	(Lcom/google/android/vending/expansion/downloader/impl/DownloadThread$State;I)V
    //   433: aload_0
    //   434: sipush 491
    //   437: aload_1
    //   438: getfield 270	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mCountRetry	Z
    //   441: aload_1
    //   442: getfield 374	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRetryAfter	I
    //   445: aload_1
    //   446: getfield 328	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mRedirectCount	I
    //   449: aload_1
    //   450: getfield 628	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mGotData	Z
    //   453: aload_1
    //   454: getfield 158	com/google/android/vending/expansion/downloader/impl/DownloadThread$State:mFilename	Ljava/lang/String;
    //   457: invokespecial 757	com/google/android/vending/expansion/downloader/impl/DownloadThread:notifyDownloadCompleted	(IZIIZLjava/lang/String;)V
    //   460: aload 4
    //   462: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   102	110	121	com/google/android/vending/expansion/downloader/impl/DownloadThread$RetryDownload
    //   102	110	131	finally
    //   25	62	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   70	102	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   113	118	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   123	128	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   133	141	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   252	257	141	com/google/android/vending/expansion/downloader/impl/DownloadThread$StopRequest
    //   25	62	309	java/lang/Throwable
    //   70	102	309	java/lang/Throwable
    //   113	118	309	java/lang/Throwable
    //   123	128	309	java/lang/Throwable
    //   133	141	309	java/lang/Throwable
    //   252	257	309	java/lang/Throwable
    //   25	62	407	finally
    //   70	102	407	finally
    //   113	118	407	finally
    //   123	128	407	finally
    //   133	141	407	finally
    //   143	202	407	finally
    //   252	257	407	finally
    //   311	355	407	finally
  }

  private static class InnerState
  {
    public int mBytesNotified = 0;
    public int mBytesSoFar = 0;
    public int mBytesThisSession = 0;
    public boolean mContinuingDownload = false;
    public String mHeaderContentDisposition;
    public String mHeaderContentLength;
    public String mHeaderContentLocation;
    public String mHeaderETag;
    public long mTimeLastNotification = 0L;
  }

  private class RetryDownload extends Throwable
  {
    private static final long serialVersionUID = 6196036036517540229L;

    private RetryDownload()
    {
    }
  }

  private static class State
  {
    public boolean mCountRetry = false;
    public String mFilename;
    public boolean mGotData = false;
    public String mNewUri;
    public int mRedirectCount = 0;
    public String mRequestUri;
    public int mRetryAfter = 0;
    public FileOutputStream mStream;

    public State(DownloadInfo paramDownloadInfo, DownloaderService paramDownloaderService)
    {
      this.mRedirectCount = paramDownloadInfo.mRedirectCount;
      this.mRequestUri = paramDownloadInfo.mUri;
      this.mFilename = paramDownloaderService.generateTempSaveFileName(paramDownloadInfo.mFileName);
    }
  }

  private class StopRequest extends Throwable
  {
    private static final long serialVersionUID = 6338592678988347973L;
    public int mFinalStatus;

    public StopRequest(int paramString, String arg3)
    {
      super();
      this.mFinalStatus = paramString;
    }

    public StopRequest(int paramString, String paramThrowable, Throwable arg4)
    {
      super(localThrowable);
      this.mFinalStatus = paramString;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.google.android.vending.expansion.downloader.impl.DownloadThread
 * JD-Core Version:    0.6.2
 */